<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>联系人列表</title>
    <link href="https://cdn.bootcss.com/twitter-bootstrap/3.0.1/css/bootstrap.min.css" rel="stylesheet">

    <script type="text/javascript" src="/js/jquery.js"></script>
    <script type="text/javascript">

        //表单执行delete方法
        function toDelete() {

            document.getElementById("method").value="delete";
            //选中第二个form表单
            document.forms[1].submit();
        }

        //表单执行导出表格方法
        function toOut(){
            document.getElementById("method").value="out";
            document.forms[1].submit();
        }


        //多选框全选
        $(function(){
            $("#btn1").click(function(){
                //1.得到点击按钮的状态  checked 属于js对象中的属性
                //jquery->js
                var state=$(this)[0].checked;
                //alert(state);
                //2.设置全选
                var cks=document.getElementsByName("connectid");
                for(var i=0;i<cks.length;i++){
                    cks[i].checked=state;
                }
            });
        })
    </script>
</head>
<body>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <h1 class="text-center text-warning">
                联系人列表
            </h1>
            <div class="div_search">
                <span>
                    <button type="button" onclick="location.href='/connector/add-ui'" class="btn btn-info">新增联系人</button>
                    <button type="button" onclick="toOut()" class="btn btn-info">导出数据</button>
                    <button type="button" onclick="toDelete()" class="btn btn-info">批量删除</button>

                    <form action="/connector/findAll" method="post">
                        机构名称:
					    <input type="text" name="charityname" value="${charityname!''}"/>
                        姓名:
					    <input type="text" name="name" value="${name!''}"/>
                        重要等级:
                        <select  name="impgrade">
                            <option value="-1">-- 请选择--</option>
                            <#list impList as imp>
                                <option value="${imp.id!''}" <#if impgrade == imp.id>selected</#if> >${imp.impname!''}</option>
                            </#list>
                        </select>
                         <input value="查询" type="submit"/>

                    </form>
                </span>
            </div>
            <br/>

            <form action="/connector/deleteOrOut" method="post">
                <#--设置隐藏域，通过id确定执行哪个方法-->
                <input type="hidden" name="method" id="method"/>

                <table class="table" width="100%">
                    <thead>
                    <tr>
                        <th>编号</th>
                        <th width="40px;"><input type="checkbox" id="btn1"/></th>
                        <th>机构名称</th>
                        <th>姓名</th>
                        <th>职务</th>
                        <th>手机</th>
                        <th>办公电话</th>
                        <th>邮箱</th>
                        <th>重要等级</th>
                        <th>跟进状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>

                    <#list pageInfo.list as connect>
                        <tr class="info">
                            <td>${connect.id}</td>
                            <td><input type="checkbox" name="connectid" value="${connect.id}"/></td>
                            <td>${connect.charityname}</td>
                            <td>${connect.name}</td>
                            <td>${connect.duty}</td>
                            <td>${connect.telephone}</td>
                            <td>${connect.phone}</td>
                            <td>${connect.email}</td>
                            <td>${connect.impname}</td>
                            <td>${connect.followname}</td>
                            <td>
                                <button type="button" onclick="location.href='/connector/update-ui?id=${connect.id}'"
                                        class="btn btn-default btn-warning">编辑
                                </button>
                                &nbsp;&nbsp;&nbsp;&nbsp;
                                <button type="button"
                                        onclick="javascript:if(confirm('确定删除?'))location.href='/connector/deleteById?id=${connect.id}';"
                                        class="btn btn-default btn-danger">删除
                                </button>
                                &nbsp;&nbsp;&nbsp;&nbsp;
                                <button type="button" onclick="location.href='/connector/info?id=${connect.id}'"
                                        class="btn btn-info">查看
                                </button>
                            </td>
                        </tr>
                    </#list>

                    </tbody>
                </table>
            </form>
            <ul class="pagination">

                <#--<#if pageInfo.hasPreviousPage>-->
                <li>
                    <a href="javascript:;" onclick="location.href='/connector/findAll?page=1&size=${pageInfo.pageSize}&charityname=${charityname!''}&name=${name!''}&impgrade=${impgrade!''}'">首页</a>
                </li>
                <li>
                    <a href="javascript:;" onclick="location.href='/connector/findAll?page=${pageInfo.prePage}&size=${pageInfo.pageSize}&charityname=${charityname!''}&name=${name!''}&impgrade=${impgrade!''}'">上一页</a>
                </li>
                <#--</#if>-->

                <#--<#if pageInfo.pageNum lt pageInfo.pages>-->
                <li>
                    <a href="javascript:;" onclick="location.href='/connector/findAll?page=${pageInfo.nextPage}&size=${pageInfo.pageSize}&charityname=${charityname!''}&name=${name!''}&impgrade=${impgrade!''}'">下一页</a>
                </li>
                <li>
                    <a href="javascript:;" onclick="location.href='/connector/findAll?page=${pageInfo.pages}&size=${pageInfo.pageSize}&charityname=${charityname!''}&name=${name!''}&impgrade=${impgrade!''}'">尾页</a>
                </li>
                &nbsp;&nbsp;&nbsp;&nbsp;<h3>共${pageInfo.total}条 ${pageInfo.pageNum}/${pageInfo.pages}</h3>
                <#--</#if>-->
            </ul>
        </div>
    </div>
</div>

</body>
</html>